package io.renren.dao;

import io.renren.common.dao.BaseDao;
import io.renren.dto.AuxiliaryMateriDTO;
import io.renren.entity.AuxiliaryMateriEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 辅材采购表
 *
 * @author 罗胜平 781757616@qq.com
 * @since 1.0.0 2019-11-22
 */
@Mapper
public interface AuxiliaryMateriDao extends BaseDao<AuxiliaryMateriEntity> {

    @Select(" SELECT * from canteens_auxiliary_materi am ,canteens_auxiliary_materialsmx " +
            " mx where mx.auxiliary_materials_id =am.auxiliary_materials_id and am.`status` >1 and mx.supplier_id = "+
            "'${id}' GROUP BY mx.auxiliary_materials_id ORDER BY am.create_date desc"
    )
    List<AuxiliaryMateriDTO> selecSupplierMateriOrder(Long id);

    @Select("SELECT  COUNT(*) as pending   from  canteens_auxiliary_materi where  `status` = '${status}' ${chedId} ${clerkId} ${canteen_Id} ")
    AuxiliaryMateriDTO getTotal(String chedId, String clerkId,String canteen_Id ,int status);
}